<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script src="../../jquery-3.2.1.js"></script>
    <script>
        let promise = new Promise((resolve, reject) => {
            if (true) {
                resolve(1);//resolve将promise的初始化状态修改为成功状态
            } else {
                reject(2);//reject将promise的初始化状态修改为失败状态
            }
        })

        $.ajax({
            method: 'get',
            url: '',
            success: (data) => {
                console.log(data);

            },
            error: (err) => {
                console.log(err);

            }
        })
    </script>

</body>

</html>